package cn.edu.zut.service;

import cn.edu.zut.dao.ReaderDao;
import cn.edu.zut.model.Reader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReaderServiceImpl implements ReaderService{
    @Autowired
    ReaderDao readerDao;
    //添加读者信息
    public int addReader(Reader reader){
        return readerDao.insertReader(reader);
    }
    //删除读者信息
    public int deleteReader(Reader reader){
        return readerDao.deleteReader(reader);
    }
    //更新读者信息
    public int updateReader(Reader reader){
       return readerDao.updateReader(reader);
    }
    //通过readerId查询读者信息
    public Reader selectByReaderId(String readerId){
        return readerDao.selectByReaderId(readerId);
    }
    //查询所有读者信息
    public List<Reader> select_All_Reader(){
        return readerDao.select_All_Reader();
    }
    //通过readerName查询读者信息
    public Reader selectByReaderName(String name){
        return readerDao.selectByReaderName(name);
    }
    //通过readerDept查询相关读者信息
    public List<Reader> selectByReaderDept(String dept){
        return readerDao.selectByReaderDept(dept);
    }
    //通过readerType查询相关读者信息
    public List<Reader> selectByReaderType(int type){
        return readerDao.selectByReaderType(type);
    }
}
